//
// Created by 39442 on 2025/10/4.
//

#ifndef THREAD_POOL_SEMAPHORE_H
#define THREAD_POOL_SEMAPHORE_H

#include <mutex>
#include <condition_variable>

class Semaphore
{
public:
    explicit Semaphore(int limit = 0) :resLimit_(limit) {}
    ~Semaphore() = default;
    void wait();
    void post();

private:
    int resLimit_;
    std::mutex mtx_;
    std::condition_variable cond_;
};


#endif //THREAD_POOL_SEMAPHORE_H